import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:scoped_model/scoped_model.dart';
import 'package:untitled/pages/home/index.dart';
import 'package:untitled/routes.dart';
import 'package:untitled/scoped_model/AuthModel.dart';
import 'package:untitled/scoped_model/room_filter.dart';

//相当于Android中的Application
class Application extends StatelessWidget {
  const Application({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    FluroRouter router = FluroRouter();
    Routes.configureRoutes(router);
    return ScopedModel<AuthModel>(
        model: AuthModel(),
        child: ScopedModel<FilterBarModel>(
            //filterBar和filterDrawer的父级添加FilterBarModel
            model: FilterBarModel(),
            //只要model在MaterialApp外那么整个app都能拿到这两个model,相当于是两个全局model
            child: MaterialApp(
              theme: ThemeData(
                  colorScheme: const ColorScheme(
                      primary: Colors.green,
                      //上方标题栏颜色
                      secondary: Colors.green,
                      background: Colors.white,
                      error: Colors.red,
                      brightness: Brightness.light,
                      onBackground: Colors.pink,
                      onError: Colors.yellow,
                      onPrimary: Colors.white,
                      //字体颜色
                      onSecondary: Colors.redAccent,
                      onSurface: Colors.redAccent,
                      surface: Colors.redAccent
                      // all fields should have a value
                      )),
              onGenerateRoute: router.generator,
            )));
  }
}
